package com.lepu.app.fun.chat.util;

import com.lepu.app.fun.chat.bean.BeanLectureChatUser;

import java.util.Comparator;

/**
 * 
 * @author xiaanming
 *
 */
public class PinyinComparatorUtil implements Comparator<BeanLectureChatUser> {

	public int compare(BeanLectureChatUser o1, BeanLectureChatUser o2) {

		String o1Alpha = o1.NickNameInitials.toUpperCase();
		String o2Alpha = o2.NickNameInitials.toUpperCase();

		if (o1Alpha.equals("@")
				|| o2Alpha.equals("#")) {
			return -1;
		} else if (o1Alpha.equals("#")
				|| o2Alpha.equals("@")) {
			return 1;
		} else {
			return o1Alpha.compareTo(o2Alpha);
		}
	}

}
